<?php
//include 'function.php';
include "QinCaptcha.class.php";
include "QinDb.class.php";
include "QinRegion.class.php";

class RegionController extends Zend_Controller_Action
{
  private $db;
  private $user;
  public function init()
  {
    $this->db = QinDb::instance();
    Zend_Db_Table::setDefaultAdapter($this->db);
  }

  public function getCitiesAction()
  {
    if ($this->getRequest()->getParam('province_code'))
      {
	$region = new QinRegion();
	$this->view->cities = $region->getCitiesList($this->getRequest()->getParam('province_code'));
      }
  }
  public function getTownsAction()
  {
    if ($this->getRequest()->getParam('city_code'))
      {
	$region = new QinRegion();
	$this->view->towns = $region->getTownsList($this->getRequest()->getParam('city_code'));
      }
  }  
}
